package com.unziper.helpapp.util;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class DisplayManager {

	private static List<String> paths = new ArrayList<String>();

	public static List<String> getFilesPaths(File root) {
		reset();
		try {
			traverse(root);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return paths;
	}

	private static void traverse(File root) throws IOException {
		if (root.isDirectory()) {
			final File[] childs = root.listFiles();
			for (File child : childs) {
				traverse(child);
			}
			return;
		}
		onFile(root);
	}

	public static void onFile(File f) {
		paths.add(f.getAbsolutePath());
	}
	
	private static void reset() {
		paths = new ArrayList<String>();
	}

}
